package com.yida.gwj.expend.service.impl;

import com.yida.common.core.utils.DateUtils;
import com.yida.gwj.expend.domain.GwjMaintenanceFundsBusinessBuild;
import com.yida.gwj.expend.mapper.GwjMaintenanceFundsBusinessBuildMapper;
import com.yida.gwj.expend.service.IGwjMaintenanceFundsBusinessBuildService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CachePut;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 业务楼栋Service业务层处理
 *
 * @author lgp
 * @date 2023-02-20
 */
@Service
public class GwjMaintenanceFundsBusinessBuildServiceImpl implements IGwjMaintenanceFundsBusinessBuildService {
    @Autowired
    private GwjMaintenanceFundsBusinessBuildMapper gwjMaintenanceFundsBusinessBuildMapper;

    /**
     * 查询业务楼栋
     *
     * @param businessBuildId 业务楼栋主键
     * @return 业务楼栋
     */
    @Override
    public GwjMaintenanceFundsBusinessBuild selectGwjMaintenanceFundsBusinessBuildByBusinessBuildId(Long businessBuildId) {
        return gwjMaintenanceFundsBusinessBuildMapper.selectGwjMaintenanceFundsBusinessBuildByBusinessBuildId(businessBuildId);
    }

    /**
     * 查询业务楼栋列表
     *
     * @param gwjMaintenanceFundsBusinessBuild 业务楼栋
     * @return 业务楼栋
     */
    @Override
    public List<GwjMaintenanceFundsBusinessBuild> selectGwjMaintenanceFundsBusinessBuildList(GwjMaintenanceFundsBusinessBuild gwjMaintenanceFundsBusinessBuild) {
        return gwjMaintenanceFundsBusinessBuildMapper.selectGwjMaintenanceFundsBusinessBuildList(gwjMaintenanceFundsBusinessBuild);
    }

    /**
     * 新增业务楼栋
     *
     * @param gwjMaintenanceFundsBusinessBuild 业务楼栋
     * @return 结果
     */
    @CachePut(value = "gwj:maintenance_funds_business_build", key = "#gwjMaintenanceFundsBusinessBuild.businessBuildId", unless = "#result == 0")
    @Override
    public int insertGwjMaintenanceFundsBusinessBuild(GwjMaintenanceFundsBusinessBuild gwjMaintenanceFundsBusinessBuild) {
        gwjMaintenanceFundsBusinessBuild.setCreateTime(DateUtils.getNowDate());
        return gwjMaintenanceFundsBusinessBuildMapper.insertGwjMaintenanceFundsBusinessBuild(gwjMaintenanceFundsBusinessBuild);
    }

    /**
     * 修改业务楼栋
     *
     * @param gwjMaintenanceFundsBusinessBuild 业务楼栋
     * @return 结果
     */
    @Override
    public int updateGwjMaintenanceFundsBusinessBuild(GwjMaintenanceFundsBusinessBuild gwjMaintenanceFundsBusinessBuild) {
        gwjMaintenanceFundsBusinessBuild.setUpdateTime(DateUtils.getNowDate());
        return gwjMaintenanceFundsBusinessBuildMapper.updateGwjMaintenanceFundsBusinessBuild(gwjMaintenanceFundsBusinessBuild);
    }

    /**
     * 批量删除业务楼栋
     *
     * @param businessBuildIds 需要删除的业务楼栋主键
     * @return 结果
     */
    @Override
    public int deleteGwjMaintenanceFundsBusinessBuildByBusinessBuildIds(Long[] businessBuildIds) {
        return gwjMaintenanceFundsBusinessBuildMapper.deleteGwjMaintenanceFundsBusinessBuildByBusinessBuildIds(businessBuildIds);
    }

    /**
     * 删除业务楼栋信息
     *
     * @param businessBuildId 业务楼栋主键
     * @return 结果
     */
    @Override
    public int deleteGwjMaintenanceFundsBusinessBuildByBusinessBuildId(Long businessBuildId) {
        return gwjMaintenanceFundsBusinessBuildMapper.deleteGwjMaintenanceFundsBusinessBuildByBusinessBuildId(businessBuildId);
    }

    /**
     * 删除业务楼栋信息
     *
     * @param businessId 业务楼栋主键
     * @return 结果
     */
    @Override
    public int deleteGwjMaintenanceFundsBusinessBuildByBusinessId(Long businessId) {
        return gwjMaintenanceFundsBusinessBuildMapper.deleteGwjMaintenanceFundsBusinessBuildByBusinessId(businessId);
    }

    @Override
    public GwjMaintenanceFundsBusinessBuild selectGwjMaintenanceFundsBusinessBuildByBusinessId(Long businessId) {
        return gwjMaintenanceFundsBusinessBuildMapper.selectGwjMaintenanceFundsBusinessBuildByBusinessId(businessId);
    }

    @Override
    public int insertBatchGwjMaintenanceFundsBusinessBuild(List<GwjMaintenanceFundsBusinessBuild> maintenanceFundsBusinessBuildList) {
        return gwjMaintenanceFundsBusinessBuildMapper.insertBatchGwjMaintenanceFundsBusinessBuild(maintenanceFundsBusinessBuildList);
    }


}
